/**
 * Wrapper for Edges so we can use them in the starter code's heap
 * implementation.
 * 
 * @author Lane Harris, Paul Flores, Kenneth Norton.
 *
 */


public class PrimEdge implements Comparable {
  /**
   * The edge we are wrapping.
   */
  private final Edge my_edge;
  
  /**
   * Instantiates a new PrimEdge.
   * 
   * @param the_edge The edge to wrap.
   */
  public PrimEdge(Edge the_edge)
  {
    my_edge = the_edge;
  }
  
  /**
   * Gets the edge.
   * 
   * @return Edge we wrapped.
   */
  public Edge getEdge()
  {
    return my_edge;
  }

  /**
   * Compares this PrimEdge to another.
   * 
   * @see java.lang.Comparable#compareTo(java.lang.Object)
   */
  @Override
  public int compareTo(Object the_other) {
    // Edge weights are doubles so we have to do a little wierdo casting here
    // We can make use of Java's Double wrapper class, though.
    Double my_weight = (Double) my_edge.getData();
    Double other_weight = (Double)((PrimEdge)the_other).getEdge().getData();
    return my_weight.compareTo(other_weight);
  }
  
}
